package com.calligraphy.user.model;

import lombok.Data;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @Author hy
 * @Date 2018/12/13 17:01
 **/
@Entity
@Data
@Table(name = "User")
@ToString
public class User implements Serializable {

	private static final long serialVersionUID = -2683385891135642351L;
	/** 用户id. */
	@Id
	private String userId;
	/** 用户名. */
	private String userName;
	/** 密码. */
	private String passWord;
	/** 邮箱（Unique）. */
	private String email;
	/** 手机号（Unique）. */
	private String phone;
	/** 头像. */
	private String userIcon;
	/** 地址. */
	private String address;
	/** 用户级别. */
	private String role;
	/** 用户token. */
	private String token;
	/** 创建时间. */
	private Timestamp createTime;
	/** 更新时间. */
	private Timestamp updateTime;

	@PrePersist
	public void onPersist() {
		createTime = new Timestamp(System.currentTimeMillis());
	}

	@PreUpdate
	public void onUpdate() {
		updateTime = new Timestamp(System.currentTimeMillis());
	}


	
	
}
